package com.cxs.xiaomi.utils;

import cxs.utils.PageBean;

/*
 * @Author:cxs
 * @Date:2021/9/15  15:26
 * @Version 1.0
 * @Motto:放下杂念,只为迎接明天更好的自己
 * 分页Bean
 * */
public class Page<T> extends PageBean<T> {
    private int startPage;
    private int endPage;

    public Page() {
    }

    public Page(int pageNum, int pageSize, int count) {
        super(pageNum, pageSize, count);
        this.startPage = super.getPageNum() - 4;
        this.endPage = super.getPageNum() + 5;
        if (getCountPage() <= 10) {
            this.startPage = 1;
            this.endPage = getCountPage();
        }else if(super.getPageNum() <= 5) {
            this.startPage = 1;
            this.endPage = 10;
        }else if(super.getPageNum() >= getCountPage() - 5) {
            this.startPage = getCountPage() - 9;
            this.endPage = getCountPage();
        }
    }

    public int getStartPage() {
        return startPage;
    }

    public void setStartPage(int startPage) {
        this.startPage = startPage;
    }

    public int getEndPage() {
        return endPage;
    }

    public void setEndPage(int endPage) {
        this.endPage = endPage;
    }
}
